package com.example.demo.exceptions;

import com.example.demo.Exception.NotLoginException;
import com.example.demo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.security.SignatureException;

@RestControllerAdvice
public class Ex {

    /**
     * 未登录
     * @param e
     * @return 返回401未登录
     */
    @ExceptionHandler(NotLoginException.class)
    public Result notLoginException(NotLoginException e) {
        return Result.error(401, e.getMessage());
    }
    @ExceptionHandler(SignatureException.class)
    public Result signatureException(SignatureException e) {
        return Result.error(403,"未知错误!");
    }


}
